package nautilus.lab.activity;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import nautilus.lab.model.Sphere;

import android.app.Activity;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.os.Bundle;

public class MyTestActivity1 extends Activity 
{
	private GLSurfaceView mGLSurfaceView;
	
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		mGLSurfaceView = new GLSurfaceView(this);
		
		mGLSurfaceView.setRenderer(new Renderer1());
		
		this.setContentView(mGLSurfaceView);
		
	}
	
	class Renderer1 implements GLSurfaceView.Renderer
	{

		private Sphere sphere;

		public Renderer1()
		{
		}
		
		@Override
		public void onDrawFrame(GL10 arg0) {
			sphere.draw();
		}

		@Override
		public void onSurfaceChanged(GL10 arg0, int width, int height) {
			// Set the OpenGL viewport to the same size as the surface.
			GLES20.glViewport(0, 0, width, height);
		}

		@Override
		public void onSurfaceCreated(GL10 arg0, EGLConfig arg1) 
		{
			// Set the background clear color to gray.
			GLES20.glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
			
			sphere = new Sphere(2, 0, 0, -5);
		}
		
	}
}
